package com.service.impl;

import com.entity.GoodsEntity;
import com.mapper.GoodsEntityMapper;
import com.service.GoodsEntityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.UUID;

/**
 * @Author: xuan
 * @Date: 2024/7/3 17:41
 * @Version: 1.0
 */
@Service
public class GoodsEntityServiceImpl implements GoodsEntityService {
    @Autowired
    private GoodsEntityMapper goodsEntityMapper;

    @Override
    public void add(GoodsEntity goodsEntity) {
        String goodsUniqueNo = UUID.randomUUID().toString().replace("-", "");
        if(goodsEntity.getGname() ==null||goodsEntity.getGname() ==" "|| goodsEntity.getGsid() ==null){
            throw new RuntimeException("数据集有误");
        }
        goodsEntity.setGoodsUniqueNo(goodsUniqueNo);
        goodsEntityMapper.insert(goodsEntity);
    }
}
